Skip to content

fix(cli): apply configured API request timeout - #1621

Open
John-David Dalton (jdalton) wants to merge 1 commit into
v1.xfrom
fix/direct-api-timeout-v1
Open

John-David Dalton (jdalton) wants to merge 1 commit into
v1.xfrom
fix/direct-api-timeout-v1

Conversation

@jdalton

@jdalton John-David Dalton (jdalton) commented Oct 15, 2026 •

Copy link
Copy Markdown
Collaborator

LLM Description written by Codex:GPT-6

Summary

  • Apply SOCKET_CLI_API_TIMEOUT to direct query and send requests.
  • Preserve the configured timeout through redirects and abort timed-out response bodies.
  • Add local HTTPS integration coverage for timeout behavior and fallback cases.

Validation

  • pnpm run test:unit src/utils/api-timeout.test.mts src/utils/api-timeout.integration.test.mts (13 passed)
  • pnpm exec tsgo --noEmit -p tsconfig.json
  • Targeted lint passed for the three changed TypeScript files

No PR template is present in .github in this checkout.


Note

Medium Risk
Changes outbound API HTTP behavior for all configured-timeout CLI calls; misconfigured low timeouts could cut off legitimately slow responses, though unset/invalid config preserves prior no-deadline semantics for raw fetches.

Overview
Wires SOCKET_CLI_API_TIMEOUT into direct Socket API traffic so queryApi / sendApiRequest (GET and POST) honor a finite positive configured deadline, while invalid values are ignored via resolveConfiguredSocketApiTimeout.

apiFetch gains an optional timeout on the underlying https.request: when set, the client destroys the request on timeout (ETIMEDOUT), propagates that through redirects, and surfaces it on aborted idle response bodies. The global API timeout is not auto-applied to bare apiFetch calls—only explicit timeout on those—so unset config still allows slow/streaming responses.

Adds unit tests for timeout resolution and a local HTTPS integration suite (with test certs) covering GET/POST failures, idle-body abort, success within limit, unset config, raw fetch behavior, and 302/307 redirects.

Reviewed by Cursor Bugbot for commit 83a3038. Configure here.

Honor configured timeout for direct CLI API calls and carry it across redirects.

Assisted-by: Codex:GPT-6

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant